//
//  GeneralCell.m
//  Run
//
//  Created by sxz on 16/4/5.
//  Copyright © 2016年 BetaTheta. All rights reserved.
//

#import "GeneralCell.h"
#import "UIImageView+WebCache.h"
@implementation GeneralCell

- (void)setGeneralModel:(GeneralModel *)generalModel {
    _generalModel = generalModel;
    
    if (self) {
        [_headImage sd_setImageWithURL:[NSURL URLWithString:generalModel.cover_img]];
        _headLabel.text = generalModel.title;
        
        _contentLabel.text = generalModel.sub_title;
    
    }
    
    
    
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.headImage = [[UIImageView alloc] initWithFrame:CGRectZero];
        
        self.headLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        _headLabel.textAlignment = NSTextAlignmentCenter;
        
        self.contentLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        _contentLabel.textAlignment = NSTextAlignmentCenter;
        _contentLabel.font = [UIFont systemFontOfSize:12];
        _contentLabel.numberOfLines = 3;
        
        self.lookLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        
        
        [self.contentView addSubview:_headImage];
        [self.contentView addSubview:_headLabel];
        [self.contentView addSubview:_contentLabel];
        [self.contentView addSubview:_lookLabel];
        
        
        
    }
    
    
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _headImage.frame = CGRectMake(0, 5, CWIDTH/4, CHEIGHT - 10);
//    _headImage.backgroundColor = [UIColor grayColor];
    
    _headLabel.frame = CGRectMake(CWIDTH/4, 5, CWIDTH * 3 / 4, CHEIGHT/3);
//    _headLabel.backgroundColor = [UIColor magentaColor];
    
    _contentLabel.frame = CGRectMake(CWIDTH/4, CHEIGHT/3 + 5, CWIDTH * 3 / 4, CHEIGHT * 2 /3 - 10);
//    _contentLabel.backgroundColor = [UIColor orangeColor];

    
}



@end
